package com.authManager.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.authManager.commons.feignApi.SysUserApi;
import com.authManager.entity.SysUser;
import com.authManager.web.model.LayuiTableData;
import com.commons.base.model.AdminPage;
import com.commons.base.model.ResultData;

@Controller
@RequestMapping(value = "user")
public class UserController extends BaseController {
	public UserController() {
		System.out.println("初始化-UserController");
	}
	@Autowired
	SysUserApi sysUserApi;

	@RequestMapping("/list")
	public String list() {
		return "user/list";
	}

	@RequestMapping("/listData")
	@ResponseBody
	public LayuiTableData<SysUser> listData(@RequestParam(defaultValue = "1", required = false) Integer pageNum,
			@RequestParam(defaultValue = "10", required = false) Integer pageSize,
			@RequestParam(required = false) String sysUserId, @RequestParam(required = false) String name,
			@RequestParam(required = false) String phone, @RequestParam(required = false) String start_creater,
			@RequestParam(required = false) String end_creater) {
		ResultData<AdminPage<SysUser>> data = sysUserApi.listSysUser(pageNum, pageSize, sysUserId, name, phone, start_creater, end_creater);
		return new LayuiTableData<SysUser>(data);
	}
}
